package com.bdqn.tour.service.impl;

import com.bdqn.tour.dao.GyhQueryALLUserInfoDao;
import com.bdqn.tour.dao.impl.GyhQueryALLUserInfoDaoImpl;
import com.bdqn.tour.pojo.PageInfo;
import com.bdqn.tour.pojo.User;
import com.bdqn.tour.service.GyhQueryALLUserInfoService;

import java.util.List;

public class GyhQueryALLUserInfoServiceImpl implements GyhQueryALLUserInfoService {
    //调用Dao层
     GyhQueryALLUserInfoDao dao=new GyhQueryALLUserInfoDaoImpl();
    @Override
    public List<User> getQueryALLUserInfo() {
        return dao.getQueryALLUserInfo();
    }



    @Override
    public PageInfo<User> getPageEmp(int pageNum, int pageSize) {
        PageInfo<User> pageInfo = new PageInfo<>();
        pageInfo.setPageSize(pageSize);
        pageInfo.setCurrPageNo(pageNum);
        //查询总条数
        pageInfo.setTotals(dao.getEmpsPageCount());
        int startIndex= (pageInfo.getCurrPageNo() - 1 ) * pageInfo.getPageSize();
        pageInfo.setList(dao.getEmpsByPage(startIndex,pageInfo.getPageSize()));
        System.out.println("查询到的分页对象:" + pageInfo);
        return pageInfo;
    }
}
